const express = require("express");
const app = express();

const cors = require("cors");
const bodyParser = require("body-parser");
const path = require("path");
const cookieParser = require("cookie-parser");
const cookieSession = require("cookie-session");

app.use(cors());
app.use(express.static(path.join(__dirname, "public")));

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use("/newsDetail", require("./routers/newsDetail/index"));
app.use("/user", require("./routers/user"));
app.use("/admin", require("./routers/admin"));
app.use("/banner", require("./routers/banner"));
app.use("/attention", require("./routers/attention"));

app.get("/", (req, res) => {
    // res.cookie("myCokkie", 123123);
    req.session["user_id"] = 54561;

    res.send("迈出第一步");
});
app.listen(3001, () => {
    console.log("http://localhost:3001 3001端口正在运行中...");
});
// insert into news_detail(title,source,digest,content,class_id) values("赌神归来","萧炎","无敌是多么寂寞","躺在木盆内，身子侵在冰凉的灵液之中，萧炎有些沉醉于体内的那股充实的力量之感，按照寻常的突破模式，一般在到达第七段之后会有一段时间的温养期，而有着筑基灵液相助的萧炎，却是直接跳过了这时期，到达了充盈阶段。",1)
// INSERT INTO news_images(img_url1,img_url2,img_url3,source) VALUES('http://localhost:3001/img/1.jpg','http://localhost:3001/img/4.jpg','http://localhost:3001/img/2.jpg',"熊三")
// select * from news_detail,news_collect where news_detail.id = news_collect.comment_id and news_collect.user_id=22 and news_collect.comment_db="comment"
